package com.edu.exam.enums.analysis;

/**
 * 难度评级枚举
 */
public enum DifficultyRating {
    VERY_EASY("VERY_EASY", "非常简单"),
    EASY("EASY", "简单"),
    MEDIUM("MEDIUM", "中等"),
    HARD("HARD", "困难"),
    VERY_HARD("VERY_HARD", "非常困难");

    private final String code;
    private final String description;

    DifficultyRating(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static DifficultyRating fromCode(String code) {
        for (DifficultyRating rating : values()) {
            if (rating.getCode().equals(code)) {
                return rating;
            }
        }
        return MEDIUM;
    }
}